/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.zonasoft.entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author JORGE
 */
@Entity
@Table(name = "eleccion", catalog = "zonificacion", schema = "")
@NamedQueries({
    @NamedQuery(name = "Eleccion.findAll", query = "SELECT e FROM Eleccion e"),
    @NamedQuery(name = "Eleccion.findByIdeleccion", query = "SELECT e FROM Eleccion e WHERE e.ideleccion = :ideleccion"),
    @NamedQuery(name = "Eleccion.findByNombre", query = "SELECT e FROM Eleccion e WHERE e.nombre = :nombre"),
    @NamedQuery(name = "Eleccion.findByPeriodoinicio", query = "SELECT e FROM Eleccion e WHERE e.periodoinicio = :periodoinicio"),
    @NamedQuery(name = "Eleccion.findByPeriodofin", query = "SELECT e FROM Eleccion e WHERE e.periodofin = :periodofin"),
    @NamedQuery(name = "Eleccion.findByFecha", query = "SELECT e FROM Eleccion e WHERE e.fecha = :fecha")})
public class Eleccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ideleccion", nullable = false, length = 4)
    private String ideleccion;
    @Basic(optional = false)
    @Column(name = "nombre", nullable = false, length = 45)
    private String nombre;
    @Basic(optional = false)
    @Column(name = "periodoinicio", nullable = false, length = 4)
    private String periodoinicio;
    @Basic(optional = false)
    @Column(name = "periodofin", nullable = false, length = 4)
    private String periodofin;
    @Basic(optional = false)
    @Column(name = "fecha", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @OneToMany(mappedBy = "ideleccion")
    private List<Candidato> candidatoList;

    public Eleccion() {
    }

    public Eleccion(String ideleccion) {
        this.ideleccion = ideleccion;
    }

    public Eleccion(String ideleccion, String nombre, String periodoinicio, String periodofin, Date fecha) {
        this.ideleccion = ideleccion;
        this.nombre = nombre;
        this.periodoinicio = periodoinicio;
        this.periodofin = periodofin;
        this.fecha = fecha;
    }

    public String getIdeleccion() {
        return ideleccion;
    }

    public void setIdeleccion(String ideleccion) {
        this.ideleccion = ideleccion;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getPeriodoinicio() {
        return periodoinicio;
    }

    public void setPeriodoinicio(String periodoinicio) {
        this.periodoinicio = periodoinicio;
    }

    public String getPeriodofin() {
        return periodofin;
    }

    public void setPeriodofin(String periodofin) {
        this.periodofin = periodofin;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public List<Candidato> getCandidatoList() {
        return candidatoList;
    }

    public void setCandidatoList(List<Candidato> candidatoList) {
        this.candidatoList = candidatoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ideleccion != null ? ideleccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Eleccion)) {
            return false;
        }
        Eleccion other = (Eleccion) object;
        if ((this.ideleccion == null && other.ideleccion != null) || (this.ideleccion != null && !this.ideleccion.equals(other.ideleccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.zonasoft.enridades.Eleccion[ideleccion=" + ideleccion + "]";
    }

}
